import React, { Component } from 'react';
import Item from './Children/item'
class Index extends Component {
    state = {
        count:1,
        person: {
            age:10
        }
    }
    render() {
        return (
            <div>
                home
                <Item person={this.state.person}></Item>
                
                <button onClick={()=>{
                    this.setState({count:this.state.count+1})
                }}>add--{this.state.count}</button>
                <button onClick={this.handleAdd}>add--{this.state.person.age}</button>
            </div>
        );
    }
    handleAdd = () => {
        let person = this.state.person
        person.age++
        this.setState({
            person
        })
    }
    componentDidMount() {
        console.log("mount");
    }
    componentDidUpdate() {
        console.log("updata");
    }
}
export default Index;